//
//  PersonCell.m
//  soccer
//
//  Created by 上官千城 on 15/9/4.
//  Copyright (c) 2015年 上官千城. All rights reserved.
//

#import "OPersonCell.h"

#define SCREENW [UIScreen mainScreen].bounds.size.width / 375
#define SCREENH [UIScreen mainScreen].bounds.size.height / 667


@implementation OPersonCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self && [reuseIdentifier isEqualToString:@"personID"]) {
        [self creatCell1];
    }

    if (self && [reuseIdentifier isEqualToString:@"photo"]) {
        [self creatCell5];
    }
    if (self && [reuseIdentifier isEqualToString:@"team"]) {
        [self creatCell6];
    }

    if (self && [reuseIdentifier isEqualToString:@"addCell"]) {
        [self creatCell7];
    }
    return self;
}
-(void)creatCell1
{
    self.head = [[UIImageView alloc]initWithFrame:CGRectMake(10 *SCREENW, 10*SCREENH, 70*SCREENW, 70 *SCREENH)];
    self.head.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.head];
    
    self.userName = [[UILabel alloc]initWithFrame:CGRectMake(self.head.frame.origin.x + self.head.frame.size.width + 10, self.head.frame.origin.y, 200, 30)];
    self.userName.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.userName];
    
    self.userID = [[UILabel alloc]initWithFrame:CGRectMake(self.userName.frame.origin.x, self.userName.frame.origin.y + self.userName.frame.size.height, self.userName.frame.size.width, 30)];
    self.userID.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.userID];
    
    self.sex = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH - 50, self.userName.frame.origin.y, 40*SCREENW, 40*SCREENH)];
    self.sex.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.sex];
    
    
    
}

-(void)creatCell2
{
    self.team = [[UILabel alloc]initWithFrame:CGRectMake(10, self.contentView.frame.size.height/2, 40, 30)];
    self.team.backgroundColor = [UIColor redColor];
    self.team.text = @"球队";
    [self.contentView addSubview:self.team];
    
    self.teamName = [[UILabel alloc]initWithFrame:CGRectMake(self.team.frame.origin.x + self.team.frame.size.width, self.team.frame.origin.y, 100, 30)];
    self.teamName.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.teamName];
    
    self.teams = [[UILabel alloc]initWithFrame:CGRectMake(self.teamName.frame.origin.x, self.teamName.frame.origin.y + self.teamName.frame.size.height, WIDTH - self.team.frame.size.width-20, 20)];
    self.teams.backgroundColor = [UIColor greenColor];
    [self.contentView addSubview:self.teams];
    
    
}

-(void)creatCell3
{
    UILabel *player1 = [[UILabel alloc]initWithFrame:CGRectMake(10, self.contentView.frame.size.height/2, 40, 30)];
    player1.text = @"球员";
    [self.contentView addSubview:player1];
    
    self.player = [[UILabel alloc]initWithFrame:CGRectMake(player1.frame.origin.x+player1.frame.size.width, player1.frame.origin.y, 100, 20)];
    self.player.backgroundColor = [UIColor greenColor];
    [self.contentView addSubview:self.player];
    
    self.players = [[UILabel alloc]initWithFrame:CGRectMake(self.player.frame.origin.x, self.player.frame.origin.y + self.player.frame.size.height, WIDTH - player1.frame.size.width -20, 20)];
    self.players.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.players];
    
}
-(void)creatCell4
{
    UILabel *Signature = [[UILabel alloc]initWithFrame:CGRectMake(10, self.contentView.frame.size.height/2, 40, 30)];
    Signature.text = @"签名";
    [self.contentView addSubview:Signature];
    
    self.massage = [[UILabel alloc]initWithFrame:CGRectMake(Signature.frame.origin.x + Signature.frame.size.width, Signature.frame.origin.y - 10, WIDTH - Signature.frame.size.width - 20, 60)];
    self.massage.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.massage];
    
}
-(void)creatCell5
{
    UILabel *photo = [[UILabel alloc]initWithFrame:CGRectMake(0, self.contentView.frame.size.height/2, 40*SCREENW, 30*SCREENH)];
    photo.text = @"相册";
//    [self.contentView addSubview:photo];
    
    self.img1 = [[UIImageView alloc]initWithFrame:CGRectMake(photo.frame.origin.x + photo.frame.size.width -10, photo.frame.origin.y - 10, self.contentView.frame.size.width/5 - 10 , self.contentView.frame.size.width/5 -10 )];
//    self.img1.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.img1];
    
    self.img2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.img1.frame.origin.x + self.img1.frame.size.width+10, self.img1.frame.origin.y, self.img1.frame.size.width,self.img1.frame.size.height )];
//    self.img2.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.img2];
    
    self.img3 = [[UIImageView alloc]initWithFrame:CGRectMake(self.img2.frame.origin.x + self.img2.frame.size.width+10, self.img2.frame.origin.y, self.img1.frame.size.width,self.img1.frame.size.height)];
//    self.img3.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.img3];
    
    self.img4 = [[UIImageView alloc]initWithFrame:CGRectMake(self.img3.frame.origin.x + self.img3.frame.size.width+10, self.img3.frame.origin.y, self.img1.frame.size.width,self.img1.frame.size.height)];
//    self.img4.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.img4];
    
    self.img5 = [[UIImageView alloc]initWithFrame:CGRectMake(self.img4.frame.origin.x + self.img4.frame.size.width+10, self.img4.frame.origin.y, self.img1.frame.size.width,self.img1.frame.size.height)];
//    self.img5.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.img5];
    
        self.img1.image = [UIImage imageNamed:@"2013103109282582218_02@2x"];
        self.img2.image = [UIImage imageNamed:@"2013103109282582218_02@2x"];
        self.img3.image = [UIImage imageNamed:@"2013103109282582218_02@2x"];
        self.img4.image = [UIImage imageNamed:@"2013103109282582218_02@2x"];
        self.img5.image = [UIImage imageNamed:@"2013103109282582218_02@2x"];
    
}
-(void)creatCell6
{
//    UILabel *zone = [[UILabel alloc]initWithFrame:CGRectMake(10, self.contentView.frame.size.height/2, 40, 30)];
//    zone.text = @"区域";
//    [self.contentView addSubview:zone];
//    
//    self.province = [[UILabel alloc]initWithFrame:CGRectMake(zone.frame.origin.x + zone.frame.size.width, zone.frame.origin.y, 60, 20)];
//    self.province.backgroundColor = [UIColor brownColor];
//    [self.contentView addSubview:self.province];
//    
//    self.city = [[UILabel alloc]initWithFrame:CGRectMake(self.province.frame.origin.x + self.province.frame.size.width+10, self.province.frame.origin.y, 70, 20)];
//    self.city.backgroundColor = [UIColor lightGrayColor];
//    [self.contentView addSubview:self.city];

    UILabel *photo = [[UILabel alloc]initWithFrame:CGRectMake(0, self.contentView.frame.size.height/2, 40*SCREENW, 30*SCREENH)];
    photo.text = @"球队";
//    [self.contentView addSubview:photo];
    
    self.starImg1 = [[UIImageView alloc]initWithFrame:CGRectMake(photo.frame.origin.x + photo.frame.size.width -10*SCREENW, photo.frame.origin.y - 10*SCREENH, self.contentView.frame.size.width/5 - 10*SCREENW , self.contentView.frame.size.width/5 -10*SCREENH )];
//    self.starImg1.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.starImg1];
    
    self.starImg2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.starImg1.frame.origin.x + self.starImg1.frame.size.width+10 *SCREENW, self.starImg1.frame.origin.y, self.starImg1.frame.size.width,self.starImg1.frame.size.height )];
//    self.starImg2.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.starImg2];
    
    self.starImg3 = [[UIImageView alloc]initWithFrame:CGRectMake(self.starImg2.frame.origin.x + self.starImg2.frame.size.width+10 *SCREENW, self.starImg2.frame.origin.y, self.starImg1.frame.size.width,self.starImg1.frame.size.height)];
//    self.starImg3.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.starImg3];
    
    self.starImg4 = [[UIImageView alloc]initWithFrame:CGRectMake(self.starImg3.frame.origin.x + self.starImg3.frame.size.width+10*SCREENW, self.starImg3.frame.origin.y, self.starImg1.frame.size.width,self.starImg1.frame.size.height)];
//    self.starImg4.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.starImg4];
    
    self.starImg5 = [[UIImageView alloc]initWithFrame:CGRectMake(self.starImg4.frame.origin.x + self.starImg4.frame.size.width+10*SCREENW, self.starImg4.frame.origin.y, self.starImg1.frame.size.width,self.starImg1.frame.size.height)];
//    self.starImg5.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.starImg5];

        self.starImg1.image = [UIImage imageNamed:@"402@2x"];
        self.starImg2.image = [UIImage imageNamed:@"403@2x"];
    self.starImg3.image = [UIImage imageNamed:@"401@2x"];
    self.starImg4.image = [UIImage imageNamed:@"403@2x"];
    self.starImg5.image = [UIImage imageNamed:@"401@2x"];
    
}
-(void)creatCell7
{
    UIButton *addFriend = [UIButton buttonWithType:UIButtonTypeCustom];
    addFriend.frame = CGRectMake(10, 10, WIDTH-20, 30*SCREENH);
    addFriend.backgroundColor = [UIColor orangeColor];
    [addFriend setTitle:@"添加好友" forState:UIControlStateNormal];
    [addFriend addTarget:self action:@selector(addfriend) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:addFriend];
}

-(void)addfriend
{
    NSLog(@"添加好友");
    [self.myDelegate addFriend];

}


@end
